/**
 * @author fu-xiao-liu
 * @Date 2022/6/7 18:56
 */
public class MapImpl2 {
    static {
        System.out.println("MapImpl2");
    }
}
class ThreadSaleTicket extends Thread{
    public  int ticket = 50;
    public static ThreadLocal<Integer> value = new ThreadLocal<Integer>(){};
    @Override
    public void run() {
        try {
            Thread.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        while(ticket > 0){
            value.set(ticket--);
            System.out.println(Thread.currentThread().getName() + "售出第： " + (50-value.get()+1) + " 张票");
        }
    }
}
 class threadSecurityTest{
    public static void main(String[] args) {
        ThreadSaleTicket salethread1 = new ThreadSaleTicket();
        Thread thread1 = new Thread(salethread1,"窗口1");
        Thread thread2 = new Thread(salethread1,"窗口2");
        thread1.start();
        thread2.start();
    }
}
